package com.atguigu.tingshu.album.mapper;

import com.atguigu.tingshu.model.album.TrackInfo;
import com.atguigu.tingshu.query.album.TrackInfoQuery;
import com.atguigu.tingshu.vo.album.AlbumTrackListVo;
import com.atguigu.tingshu.vo.album.TrackListVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface TrackInfoMapper extends BaseMapper<TrackInfo> {


    /**
     * 获取当前专辑的最大排序号
     * @param albumId
     * @return
     */
    @Select("select order_num from track_info where album_id = #{albumId} order by order_num desc limit 1")
    Integer selectTrackMaxOrderNum(Long albumId);

    /**
     * 分页条件查询声音列表
     * @param trackInfoQuery
     * @param trackListVoPage
     * @return
     */
    Page<TrackListVo> selectTrackInfo(@Param("vo") TrackInfoQuery trackInfoQuery,
                           Page<TrackListVo> trackListVoPage);

    Page<AlbumTrackListVo> selectPageTrackInfoListByAlbumId(Long albumId, Page<AlbumTrackListVo> albumTrackListVoPage);
}
